<template>
	<view class="content">
		<view class="avatorWrapper">
			<view class="avator">
				<image class="img" src="../../static/uni.png" mode="widthFix"></image>
			</view>
		</view>
		<view class="form">
			<view class="inputWrapper">
				<input class="input" type="text" v-model="username" placeholder="请输入用户名" />
			</view>
			<view class="inputWrapper">
				<input class="input" type="password" v-model="pwd" placeholder="请输入密码" />
			</view>
			<view class="loginBtn">
				<text class="btnValue" @click="login()">登录</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username : "",
				pwd : ""
			}
		},
		onLoad() {
			
		},
		methods: {
			login(){
				uniCloud.callFunction({
					name:"loginCloud",
					data:{
						username : this.username,
						pwd : this.pwd
					}
				}).then(res=>{
					console.log(res)
					let result = res.result.data
					if(result!=null){
						uni.switchTab({
							url:"/pages/index/index"
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.content {
		background: #6fb48f;
		width: 100vw;
		height: 100vh;
	}

	.avatorWrapper {
		height: 30vh;
		width: 100vw;
		display: flex;
		justify-content: center;
		align-items: flex-end;
	}

	.avator {
		width: 200upx;
		height: 200upx;
		overflow: hidden;
	}

	.avator .img {
		width: 100%
	}

	.form {
		padding: 0 100upx;
		margin-top: 80px;
	}

	.inputWrapper {
		width: 100%;
		height: 80upx;
		background: white;
		border-radius: 20px;
		box-sizing: border-box;
		padding: 0 20px;
		margin-top: 25px;
	}

	.inputWrapper .input {
		width: 100%;
		height: 100%;
		text-align: center;
		font-size: 15px;
	}

	.loginBtn {
		width: 100%;
		height: 80upx;
		background: #b39d94;
		border-radius: 50upx;
		margin-top: 50px;
		display: flex;
		justify-content: center;
		align-items: center;

	}

	.loginBtn .btnValue {
		color: white;
	}
</style>
